package com.bupt.server.obj;

import com.bupt.server.entity.Room;
import com.bupt.server.entity.Service_Record;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class PublicData {
    public static Map<Integer, Room> totalRoomList = new HashMap<Integer,Room>();

    public static List<Integer> waitingList = new ArrayList<>();
    public static List<Integer> serveList = new ArrayList<>();
    public static String temp = "heat";
    public static boolean schedule_ok = false;

    public static int GetRoomPrice(int room_id){
        return switch (room_id) {
            case 1 -> 100;
            case 2 -> 125;
            case 3 -> 150;
            case 4 -> 200;
            case 5 -> 100;
            default -> 0;
        };
    }

    public static void resetRoom(String mode,int room_id){
        Room room = totalRoomList.get(room_id);
        room.record_row = 1;
        room.recordList.clear();
        room.getRecordRaw().clear();
        room.initRecordRaw();
        room.setWaitingTimer(-1);
        room.setServerTimer(-1);
        room.setCustomer_id(null);
        room.setStatus(false);
        room.start_time=-1;
        room.end_time=-1;
        room.request_time=-1;
        room.record_row = 1;
        if(mode.equals("heat")){
            room.setMode("heat");
            if(room_id==1){
                room.setCurrent_temperature(10);
                room.init_temperature = 10;
                room.setTarget_temperature(22);
                room.setAc_status("off");
                room.setTotal_air_cost(0);
                room.setTotal_cost(0);
            }else if(room_id==2){
                room.setCurrent_temperature(15);
                room.init_temperature = 15;
                room.setAc_status("off");
                room.setTarget_temperature(22);
                room.setTotal_air_cost(0);
                room.setTotal_cost(0);
            }else if(room_id==3){
                room.setCurrent_temperature(18);
                room.init_temperature = 18;
                room.setAc_status("off");
                room.setTarget_temperature(22);
                room.setTotal_air_cost(0);
                room.setTotal_cost(0);
            }else if(room_id==4){
                room.setCurrent_temperature(12);
                room.init_temperature = 12;
                room.setAc_status("off");
                room.setTarget_temperature(22);
                room.setTotal_air_cost(0);
                room.setTotal_cost(0);
            }else if(room_id==5){
                room.setCurrent_temperature(14);
                room.init_temperature = 14;
                room.setTarget_temperature(22);
                room.setAc_status("off");
                room.setTotal_air_cost(0);
                room.setTotal_cost(0);
            }
        }else{
            room.setMode("cold");
            if(room_id==1){
                room.setCurrent_temperature(32);
                room.init_temperature = 32;
                room.setTarget_temperature(25);
                room.setAc_status("off");
                room.setTotal_air_cost(0);
                room.setTotal_cost(0);
            }else if(room_id==2){
                room.setCurrent_temperature(28);
                room.init_temperature = 28;
                room.setAc_status("off");
                room.setTarget_temperature(25);
                room.setTotal_air_cost(0);
                room.setTotal_cost(0);
            }else if(room_id==3){
                room.setCurrent_temperature(30);
                room.init_temperature = 30;
                room.setTarget_temperature(25);
                room.setAc_status("off");
                room.setTotal_air_cost(0);
                room.setTotal_cost(0);
            }else if(room_id==4){
                room.setCurrent_temperature(29);
                room.init_temperature = 29;
                room.setTarget_temperature(25);
                room.setAc_status("off");
                room.setTotal_air_cost(0);
                room.setTotal_cost(0);
            }else if(room_id==5){
                room.setCurrent_temperature(35);
                room.init_temperature = 35;
                room.setTarget_temperature(25);
                room.setAc_status("off");
                room.setTotal_air_cost(0);
                room.setTotal_cost(0);
            }
        }
    }


}
